#!/bin/bash

# 脚本出错时立即退出
set -e

# 1. 生成 eBPF Go 代码
echo "Generating eBPF code..."
go generate ./pkg/ebpf/...

# 2. 编译 gopack 二进制文件
echo "Building gopack binary..."
go build -o gopack .

# 3. 将二进制文件移动到系统 PATH 路径下
# 注意: 此步骤需要 sudo 权限
echo "Installing gopack to /usr/local/bin/..."
sudo mv gopack /usr/local/bin/

# 4. 验证安装
echo "Installation complete. Verifying installation..."
gopack version
